package com.alliky.core.permission;

import android.os.Build;

import androidx.annotation.RequiresApi;

import java.util.function.Consumer;

@RequiresApi(api = Build.VERSION_CODES.N)
public abstract class RxPermissionConsumer implements Consumer<Boolean> {

    public abstract void success();

    public void onAsk() {
    }

    public String getPermissionName(String permissionName) {
        return permissionName;
    }

    @Override
    public void accept(Boolean aBoolean) {
        if (aBoolean){
            success();
        }else {
            onAsk();
        }
    }
}
